<?php
/***************************************************************
*  Copyright notice
*  (c) 2009, jianyuzhu@gmail.com
*  All rights reserved
*  This script is part of the PPEMI project.
***************************************************************/

//
include_once(CONFIG_PATH . CONFIG_DIR_CLASSES . 'base.item.class.php');

class AskQuestionBase extends BaseItemBase {
	
	//constructor
	function AskQuestionBase() {
		parent::BaseItemBase();
		
		$this->table = 'pp_apps_asks_questions';
		$this->prefix = 'a_';
		$this->_table_status_value = '0';
		
		$this->filter_fields = array('status:=', 'digest:=');
		$this->filter_map = array('status' => 'status:=', 'digest' => 'digest:=');
	}
	
	//methods
	function getBeDueItems($filter = '') {
		$this->sort_fields = array('date_end-', 'date_start+', 'date_added+');
		if( !is_array($filter) ) {
			$filter = array();
		}
		$filter['status:='] = '0';
		
		return $this->getItems($filter, -1, true);
	}
	
	function getBeDueItemsTotal($filter = '') {
		$this->sort_fields = array('date_end-', 'date_start+', 'date_added+');
		if( !is_array($filter) ) {
			$filter = array();
		}
		$filter['status:='] = '0';
		
		return $this->getItemsTotal($filter, -1);
	}
}
//
?>